<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" >
<head th:replace="~{common/import :: tophead}">
    <title>Blogs</title>
</head>
<body>
<div th:replace="~{common/topBar :: nav}"></div>
<div class="container-fluid main" id="contentMain">
    <div class="row">
        <div class="col-lg-9 col-md-12 col-sm-12 col-xs-12">
            <h4>
                <span th:text="${sectionName}"></span>
            </h4>
            <span class="pull-right">
                <img th:src="@{/images/check-circle.svg}" style="width: 20%;">
                <a href="/notification/0" th:if="${section=='replies'}" class="a-no-line">一键已读</a>
            </span>
            <hr>

            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 mangerFrame" th:fragment="questionList">
                <div class="media" th:each="blog : ${allBlogs.list}">
                    <div class="media-left">
                        <a href="#">
                            <img class="media-object img-rounded"
                                 th:src="${blog.user.avatar_url}">
                        </a>
                    </div>
                    <div class="media-body">
                        <h4 class="media-heading">
                            <a th:href="@{'/blog/'+ ${blog.id}}" th:text="${blog.title}"></a>
                        </h4>
                        <span class="text-desc">
                            <span th:text="${blog.view_count}"></span>次浏览·
                            <span th:text="${#dates.format(blog.updateTime,'yyyy-MM-dd HH:mm')}"></span>

                            <a  class="community-menu" th:data-qid="${blog.id}"
                                th:if="${session.user != null && session.user.id == blog.user_id}"
                                onclick="deleteQuestion(this)">
                            <span class="glyphicon glyphicon-trash pull-right "
                                  aria-hidden="true">&thinsp;删除</span>
                            </a>
                            <a th:href="@{'/publish/'+${blog.id}}" class="community-menu">
                                <span th:if="${session.user != null && session.user.id == blog.user_id}"
                                      class="glyphicon glyphicon-pencil pull-right" style="padding-right: 15px;" aria-hidden="true">&thinsp;编辑</span>
                            </a>
                        </span>
                    </div>
                </div >
                <!--分页条-->
                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" th:if="${allBlogs.pages}>1">
                    <nav aria-label="Page navigation" class="pull-right">
                        <ul class="pagination">
                            <li th:if="!${allBlogs.isFirstPage}">
                                <a th:href="@{/manger/blogs(page=${1})}" aria-label="Previous">
                                    <span aria-hidden="true">&laquo;</span>
                                </a>
                            </li>
                            <li th:if="!${allBlogs.isFirstPage}">
                                <a th:href="@{/manger/blogs(page=${allBlogs.pageNum} - 1)}" aria-label="Previous">
                                    <span aria-hidden="true">&lsaquo;</span>
                                </a>
                            </li>
                            <li th:if="!${allBlogs.isLastPage}">
                                <a th:href="@{/manger/blogs(page=${allBlogs.pageNum} + 1)}" aria-label="Next">
                                    <span aria-hidden="true">&rsaquo;</span>
                                </a>
                            </li>
                            <li th:if="!${allBlogs.isLastPage}">
                                <a th:href="@{/manger/blogs(page=${allBlogs.pages})}" aria-label="Next">
                                    <span aria-hidden="true">&raquo;</span>
                                </a>
                            </li>
                        </ul>
                    </nav>
                </div>
            </div>

<!--            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 mangerFrame" th:if="${section == 'replies'}">-->
<!--                <div class="media" th:each="notification : ${pagination.data}">-->
<!--                    <div class="media-body">-->
<!--                        <p class="media-heading">-->
<!--                            <span th:text="${notification.notifierName +' ' + notification.typeName + ' '}"></span>-->
<!--                            <a th:href="@{'/notification/'+ ${notification.id}}"-->
<!--                               th:text="${notification.outerTitle}">-->
<!--                            </a>-->
<!--                            <span class="label label-danger" th:if="${notification.status == 0}">未读</span>-->
<!--                        </p>-->
<!--                    </div>-->
<!--                </div>-->
<!--                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">-->
<!--                    <nav aria-label="Page navigation" class="pull-right">-->
<!--                        <ul class="pagination">-->
<!--                            <li th:if="${pagination.showFirstPage}">-->
<!--                                <a th:href="@{'/manger/'+${section}(page=${1})}" aria-label="Previous">-->
<!--                                    <span aria-hidden="true">&laquo;</span>-->
<!--                                </a>-->
<!--                            </li>-->
<!--                            <li th:if="${pagination.showPrevious}">-->
<!--                                <a th:href="@{'/manger/'+${section}(page=${pagination.page - 1})}" aria-label="Previous">-->
<!--                                    <span aria-hidden="true">&lsaquo;</span>-->
<!--                                </a>-->
<!--                            </li>-->
<!--                            <li th:each="page : ${pagination.pages}" th:class="${pagination.page == page} ? 'active' : ''">-->
<!--                                <a th:href="@{'/manger/'+${section}(page=${page})}" th:text="${page}">-->
<!--                                </a>-->
<!--                            </li>-->
<!--                            <li th:if="${pagination.showNext}">-->
<!--                                <a th:href="@{'/manger/'+${section}(page=${pagination.page + 1})}" aria-label="Next">-->
<!--                                    <span aria-hidden="true">&rsaquo;</span>-->
<!--                                </a>-->
<!--                            </li>-->
<!--                            <li th:if="${pagination.showEndPage}">-->
<!--                                <a th:href="@{'/manger/'+${section}(page=${pagination.totalPage})}" aria-label="Next">-->
<!--                                    <span aria-hidden="true">&raquo;</span>-->
<!--                                </a>-->
<!--                            </li>-->
<!--                        </ul>-->
<!--                    </nav>-->
<!--                </div>-->
<!--            </div>-->
        </div>

        <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12">
            <div class="list-group" style="margin-top: 15px">
                <a th:href="@{/manger/blogs}" th:class="${section == 'blogs'} ? 'active list-group-item' : 'list-group-item'">
                    <img th:src="@{/images/blog-square.svg}" style="width: 6%">
                    我的Blog
                </a>
                <a th:href="@{/manger/replies}" th:class="${section == 'replies'} ? 'active list-group-item' : 'list-group-item'">
                    <img th:src="@{/images/bell.svg}" style="width: 6%">
                    最新回复
                    <span th:if="${session.unreadCount!=0}">
                        <span class="badge" th:text="${session.unreadCount}"></span>
                    </span>
                </a>
            </div>
        </div>
    </div>
</div>
<div th:replace="~{common/footer :: foot}"></div>
</body>
</html>